package org.zp.service;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.zp.mapper.AdminInfoMapper;
import org.zp.pojo.AdminInfo;
import org.zp.util.DBUtil;
import org.zp.util.MyBatisUtil;

import com.github.pagehelper.PageHelper;
@Service
@Transactional(rollbackFor = Exception.class)//出现异常就回滚事务
public class AdminInfoServiceImpl implements AdminInfoService{
	
	@Resource
	private AdminInfoMapper a;
	
	
	@Override
	public AdminInfo mybatisLogin(String name, String pwd) {
		
		return a.selectByNameAndPwd(name, pwd);
	}


	@Override
	public List<AdminInfo> selectadmin(Integer startpage, Integer limitpage, String name, Long role, String strart, String end) {
		PageHelper.startPage(startpage, limitpage);
		return a.selectASPPAdmin(name, role, strart, end);
	}


	@Override
	public Integer updateAdminState(int aid, int iStatus) {

		return a.updateAdminState(aid, iStatus);
	}



	@Override
	public Integer deleteAdmin(int aid) {

		return a.deleteAdmin(aid);
	}



	@Override
	public Integer newAdminpwd(int aid) {

		return a.newpwd(aid);
	}



	@Override
	public Integer addAdmin(AdminInfo sa) {

		return a.insertAdmin(sa);
	}



	@Override
	public Integer updateAdmindate(Long aid, String aName, String aPwd, String uAccount) {
		
		return a.updateAdmindate(aid,aName,aPwd,uAccount);
	}


	@Override
	public List<AdminInfo> showAdmin() {
		// TODO Auto-generated method stub
		return a.showAdmin();
	}


	@Override
	public AdminInfo getAdminByAid(Long aid) {
		// TODO Auto-generated method stub
		return a.getAdminByAid(aid);
	}


	@Override
	public AdminInfo checkAdminInfo(String account, String pwd) {
		// TODO Auto-generated method stub
		return a.checkAdminInfo(account,pwd);
	}






	

}
